package org.example.exception;

import org.example.entity.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author TonySong
 * @date 2024/4/25 0025
 * @time 15:45
 */
@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler(value = Exception.class)
    public R handler(Exception e) {
        return R.err(e.getMessage());
    }

    @ExceptionHandler(value = UserNotFoundException.class)
    public R handler(UserNotFoundException e) {
        return R.err("对不起，账号或密码错误！");
    }
}
